<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@page import="java.sql.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
当前所有用户列表：
<table border="2" width="300">
	<tr>
		<td>id</td>
		<td>姓名</td>
		<td>密码</td>
		<td>年龄</td>
		<td>性别</td>
		<td>生日</td>
		<td>描述</td>
		<td>删除操作</td>
	</tr>
		<font type="submit"color="green"><a href="main.jsp">返回</a></font><br>

<%
	//加载驱动
String driverClass="com.mysql.jdbc.Driver";
String url="jdbc:mysql://localhost:3306/test";
String username="root";
String password="lishanshan";
	Connection conn = DriverManager.getConnection(url, username, password);
	/* if(conn!=null){
		out.print("123");
	} */
	//定义sql语句
	String sql = "select * from person;";
	//预编译
	PreparedStatement stmt = conn.prepareStatement(sql);
	//执行
	ResultSet rs = stmt.executeQuery();
	//数据显示
	while(rs.next())
	{
		//out.print(rs.getInt("id")+"-"+rs.getString("NAME"));
%>
	<tr>
		<td><%=rs.getInt("id") %></td>
		<td><%=rs.getString("name") %></td>
		<td><%=rs.getString("password") %></td>
		<td><%=rs.getString("age") %></td>
		<td><%=rs.getString("sex") %></td>
		<td><%=rs.getString("birthday") %></td>
		<td><%=rs.getString("descriptions") %></td>
		<td><a href="delete1.jsp?id=<%=rs.getInt("id") %>">删除</a></td>
	</tr>
<% 
	}
	conn.close();
 %>
</table>
</body>
</html>